home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / SoundInput.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  6.0 KB  |  175 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Wednesday, June 27, 1990 at 6:42 PM
  3.     SoundInput.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc. 1989-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT SoundInput;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingSoundInput}
  21. {$SETC UsingSoundInput := 1}
  22.  
  23. {$I+}
  24. {$SETC SoundInputIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingFiles}
  30. {$I $$Shell(PInterfaces)Files.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := SoundInputIncludes}
  33.  
  34.  
  35. CONST
  36.  
  37. siDeviceIsConnected =     1;                { input device is connected and ready for input }
  38. siDeviceNotConnected =     0;                { input device is not connected }
  39. siDontKnowIfConnected =    -1;                { can't tell if input device is connected }
  40.  
  41. siReadPermission =         0;                { permission passed to SPBOpenDevice }
  42. siWritePermission =      1;                { permission passed to SPBOpenDevice }
  43.  
  44. { Info Selectors for Sound Input Drivers }
  45.  
  46. siDeviceConnected =        'dcon';            { input device connection status }
  47. siAGCOnOff =            'agc ';            { automatic gain control state }
  48. siPlayThruOnOff    =        'plth';            { playthrough state }
  49. siTwosComplementOnOff =    'twos';            { two's complement state }
  50. siLevelMeterOnOff =        'lmet';            { level meter state }
  51. siRecordingQuality =    'qual';            { recording quality }
  52. siVoxRecordInfo    =        'voxr';            { VOX record parameters }
  53. siVoxStopInfo =            'voxs';            { VOX stop parameters }
  54. siNumberChannels =        'chan';            { current number of channels }
  55. siSampleSize =            'ssiz';            { current sample size }
  56. siSampleRate =            'srat';            { current sample rate }
  57. siCompressionType =        'comp';            { current compression type }
  58. siCompressionFactor    =    'cmfa';            { current compression factor }
  59. siCompressionHeader    =    'cmhd';            { return compression header }
  60. siDeviceName =            'name';            { input device name }
  61. siDeviceIcon =            'icon';            { input device icon }
  62. siDeviceBufferInfo =    'dbin';            { size of interrupt buffer }
  63. siSampleSizeAvailable =    'ssav';            { sample sizes available }
  64. siSampleRateAvailable =    'srav';            { sample rates available }
  65. siCompressionAvailable ='cmav';            { compression types available }
  66. siChannelAvailable =    'chav';            { number of channels available }
  67. siAsync    =                'asyn';            { asynchronous capability }
  68. siOptionsDialog =        'optd';            { display options dialog }
  69. siContinuous =             'cont';            { continous recording }
  70. siActiveChannels =         'chac';            { active channels }
  71. siActiveLevels =         'lmac';            { active meter levels }
  72. siInitializeDriver =    'init';            { reserved for internal use only }
  73. siCloseDriver =            'clos';            { reserved for internal use only }
  74. siPauseRecording =        'paus';            { reserved for internal use only }
  75. siUserInterruptProc    =    'user';            { reserved for internal use only }
  76.  
  77. { Qualities }
  78.  
  79. siBestQuality =            'best';
  80. siBetterQuality =        'betr';
  81. siGoodQuality =            'good';
  82.  
  83.  
  84. TYPE
  85.  
  86. SPBPtr = ^SPB;
  87. SPB = RECORD
  88.     inRefNum:            LONGINT;            { reference number of sound input device }
  89.     count:                LONGINT;            { number of bytes to record }
  90.     milliseconds:        LONGINT;            { number of milliseconds to record }
  91.     bufferLength:        LONGINT;            { length of buffer in bytes }
  92.     bufferPtr:            Ptr;                { buffer to store sound data in }
  93.     completionRoutine:    ProcPtr;            { completion routine }
  94.     interruptRoutine:    ProcPtr;            { interrupt routine }
  95.     userLong:            LONGINT;            { user-defined field }
  96.     error:                OSErr;                { error }
  97.     unused1:            LONGINT;            { reserved - must be zero }
  98.     END;
  99.  
  100.  
  101. FUNCTION SPBVersion : NumVersion;
  102.     INLINE $203C,$0000,$0014,$A800;
  103.  
  104. FUNCTION SndRecord(filterProc: ProcPtr; corner: Point; quality: OSType;
  105.     VAR sndHandle: Handle) : OSErr;
  106.     INLINE $203C,$0804,$0014,$A800;
  107.  
  108. FUNCTION SndRecordToFile(filterProc: ProcPtr; corner: Point; quality: OSType;
  109.     fRefNum: INTEGER) : OSErr;
  110.     INLINE $203C,$0708,$0014,$A800;
  111.  
  112. FUNCTION SPBSignInDevice(deviceRefNum: INTEGER; deviceName: Str255) : OSErr;
  113.     INLINE $203C,$030C,$0014,$A800;
  114.  
  115. FUNCTION SPBSignOutDevice(deviceRefNum: INTEGER) : OSErr;
  116.     INLINE $203C,$0110,$0014,$A800;
  117.  
  118. FUNCTION SPBGetIndexedDevice(count: INTEGER; VAR deviceName: Str255;
  119.     VAR deviceIconHandle: Handle) : OSErr;
  120.     INLINE $203C,$0514,$0014,$A800;
  121.  
  122. FUNCTION SPBOpenDevice(deviceName: Str255; permission: INTEGER; VAR inRefNum: LONGINT) : OSErr;
  123.     INLINE $203C,$0518,$0014,$A800;
  124.  
  125. FUNCTION SPBCloseDevice(inRefNum: LONGINT) : OSErr;
  126.     INLINE $203C,$021C,$0014,$A800;
  127.  
  128. FUNCTION SPBRecord(inParamPtr: SPBPtr; asynchFlag: BOOLEAN) : OSErr;
  129.     INLINE $203C,$0320,$0014,$A800;
  130.  
  131. FUNCTION SPBRecordToFile(fRefNum: INTEGER; inParamPtr: SPBPtr; asynchFlag: BOOLEAN) : OSErr;
  132.     INLINE $203C,$0424,$0014,$A800;
  133.  
  134. FUNCTION SPBPauseRecording(inRefNum: LONGINT) : OSErr;
  135.     INLINE $203C,$0228,$0014,$A800;
  136.  
  137. FUNCTION SPBResumeRecording(inRefNum: LONGINT) : OSErr;
  138.     INLINE $203C,$022C,$0014,$A800;
  139.  
  140. FUNCTION SPBStopRecording(inRefNum: LONGINT) : OSErr;
  141.     INLINE $203C,$0230,$0014,$A800;
  142.  
  143. FUNCTION SPBGetRecordingStatus(inRefNum: LONGINT; VAR recordingStatus: INTEGER; VAR meterLevel: INTEGER;
  144.     VAR totalSamplesToRecord: LONGINT; VAR numberOfSamplesRecorded: LONGINT;
  145.     VAR totalMsecsToRecord: LONGINT; VAR numberOfMsecsRecorded: LONGINT) : OSErr;
  146.     INLINE $203C,$0E34,$0014,$A800;
  147.  
  148. FUNCTION SPBGetDeviceInfo(inRefNum: LONGINT; infoType: OSType; infoData: Ptr) : OSErr;
  149.     INLINE $203C,$0638,$0014,$A800;
  150.  
  151. FUNCTION SPBSetDeviceInfo(inRefNum: LONGINT; infoType: OSType; infoData: Ptr) : OSErr;
  152.     INLINE $203C,$063C,$0014,$A800;
  153.  
  154. FUNCTION SPBMillisecondsToBytes(inRefNum: LONGINT; VAR milliseconds: LONGINT) : OSErr;
  155.     INLINE $203C,$0440,$0014,$A800;
  156.  
  157. FUNCTION SPBBytesToMilliseconds(inRefNum: LONGINT; VAR byteCount: LONGINT) : OSErr;
  158.     INLINE $203C,$0444,$0014,$A800;
  159.  
  160. FUNCTION SetupSndHeader(sndHandle: Handle; numChannels: INTEGER; sampleRate: Fixed;
  161.                 sampleSize: INTEGER; compressionType: OSType; baseNote: INTEGER;
  162.                 numBytes: LONGINT; VAR headerLen: INTEGER) : OSErr;
  163.     INLINE $203C,$0D48,$0014,$A800;
  164.  
  165. FUNCTION SetupAIFFHeader(fRefNum: INTEGER;  numChannels: INTEGER; sampleRate: Fixed;
  166.                 sampleSize: INTEGER; compressionType: OSType;
  167.                 numBytes: LONGINT; numFrames: LONGINT) : OSErr;
  168.     INLINE $203C,$0B4C,$0014,$A800;
  169.  
  170. {$ENDC}    { UsingSoundInput }
  171.  
  172. {$IFC NOT UsingIncludes}
  173.     END.
  174. {$ENDC}
  175.